/**
 * 用户类
 * Created by hice on 2017/3/30.
 */
import vueutil from '@/common/vue-util'
const state = {
  isLogin: sessionStorage.getItem('isLogin'),
  //登录返回信息
  loginInfo: {}
}

const getters = {}

const actions = {}

const mutations = {
  //用户登录
  USER_LOGIN: (state, { body, that }) => {
    if (!vueutil.check.isEmpty(body.result.token)) {
      sessionStorage.setItem('isLogin', true);
      state.isLogin = true
      state.loginInfo = body.result
      that.$router.back();
    }
  }

}

export default {
  state,
  mutations,
  getters,
  actions
}
